<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<div class="t_bar">
	<span class="color_red">*</span>
	项目基本情况
</div>
<table class="t_css" width="100%" border="0" cellpadding="0"
	cellspacing="1" id="projectBasicInfo">
	<col style="width: 20%" />
	<col style="width: 30%" />
	<col style="width: 20%" />
	<col style="width: 30%" />
	<tr>
		<td align="right" width="20%">
			<span class="color_red">*</span>项目名称：
		</td>
		<td colspan="3">
			<c:set var="submit_org"><x:out select="$xmlData/data/organizations/organization[@submit_org=1]/org_name"/></c:set>
			<span name="proposal/zh_title_sub">${submit_org}在皖转化科技成果后补助</span>
			<input name="proposal/zh_title" value="${submit_org}在皖转化科技成果后补助" type="hidden"/>
		</td>
	</tr>
	<tr>
		<td align="right" width="20%"><span class="color_red">*</span>归口管理部门：</td>
		<td colspan="">
			<c:set var="recomend_org">
				{'id':'<x:out select="$xmlData/data/proposal/recomend_org_value" />',
				'name':'<x:out select="$xmlData/data/proposal/recomend_org_name" />'
				}					
			</c:set>
			<cpt:tree id="recomend_org" key="recommended_org" cacheable="false"
				className="hn_iuput_kuang required selectWidth3" readonly="true"
				value="${recomend_org}" label="项目基本情况-->归口管理部门" showPattern="all"
				shieldPattern="0" onClick="initTreeValue2">
			</cpt:tree>
			<input type="hidden" id="recomend_org_value"
				name="proposal/recomend_org_value"
				value="<x:out select="$xmlData/data/proposal/recomend_org_value" />">
			<input type="hidden" name="proposal/recomend_org_name"
				value="<x:out select="$xmlData/data/proposal/recomend_org_name" />">
		</td>
		<td align="right" width="20%"><span class="color_red">*</span>申报时间：</td>
		<td>
			<c:set var="submit_date"><x:out select="$xmlData/data/proposal/submit_date"/></c:set>
			<cpt:date id="submit_date" value="${submit_date }"
					className="required date beforeToday" label="项目基本情况-->申报时间" name="proposal/submit_date"></cpt:date>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>单位类型：<br/>（多选）</td>
		<td colspan="3"><c:set var="unit_type3_value"><x:out select="$xmlData/data/proposal/unit_type3_value" /></c:set>
			<cpt:checkbox key="unit_type3" name="unit_type3" repeatColumn="5" ></cpt:checkbox>
			<input type="hidden" name="proposal/unit_type3_value" class="required"  value="${unit_type3_value}" label="项目基本情况-->单位类型">
			<input type="hidden" name="proposal/unit_type3_name" value="<x:out select="$xmlData/data/proposal/unit_type3_name" />"> </td>
	</tr>
	<tr>
		<td align="right">
			<span class="color_red">*</span>项目联系人姓名：
		</td>
		<td>
			<input name="proposal/contact_psn_cname" label="项目基本情况-->项目联系人姓名"
				type="text" required class="required maxlength:30"
				value="<x:out select="$xmlData/data/proposal/contact_psn_cname" />" />
		</td>
		<td align="right">
			<span class="color_red">*</span>联系人手机：
		</td>
		<td>
			<input name="proposal/contact_psn_mobile" label="项目基本情况-->联系人手机"
				type="text" required class="required maxlength:30" onfocus="InitInput.setNumber(this,11,0,0);"
				value="<x:out select="$xmlData/data/proposal/contact_psn_mobile" />" />
		</td>
	</tr>
	<tr>
		<td align="right">
			<span class="color_red">*</span>通讯地址：
		</td>
		<td>
			<input name="proposal/address" label="项目基本情况-->通讯地址"
				   type="text" required class="required "
				   value="<x:out select="$xmlData/data/proposal/address" />" />
		</td>
		<td align="right">
			<span class="color_red">*</span>电子邮箱：
		</td>
		<td>
			<input name="proposal/mail" label="项目基本情况-->电子邮箱"
				   type="text" required class="required email"
				   value="<x:out select="$xmlData/data/proposal/mail" />" />
		</td>
	</tr>
	<tr>
		<%--<td align="right">
			<span class="color_red">*</span>项目报审级次（省补助资金拨付所属财政局）：
		</td>
		<td>
			<c:set var="sub_step">
				{'id':'<x:out select="$xmlData/data/proposal/sub_step_value" />',
			 	 'name':'<x:out select="$xmlData/data/proposal/sub_step_name" />'}
			</c:set>
			<cpt:tree key="sub_step" cacheable="false"
				className="hn_iuput_kuang selectWidth3" readonly="true" value="${sub_step}"
			 	id="sub_step" showPattern="all" shieldPattern="0" onlyChooseLeaf="false"
				topCheckbox="true" onClick="initTreeValueExt" />
			<input type="hidden" id="sub_step_value"
				name="proposal/sub_step_value" class="required" label="项目基本情况-->项目报审级次"
				value="<x:out select="$xmlData/data/proposal/sub_step_value" />"/>
			<input type="hidden" name="proposal/sub_step_name" id="sub_step_name"
				value="<x:out select="$xmlData/data/proposal/sub_step_name" />">
		</td>--%>
		<td align="right">
			<span class="color_red">*</span>项目申请金额（万元）：
		</td>
		<td colspan="3">
			<input type="text" style="text-align: right; width: 100px"
				name="budgets/project_apply_money" class="required"
				label="项目基本情况-->项目申请金额" id="applyMoney"
				value="<x:out select="$xmlData/data/budgets/project_apply_money" />"
				onfocus="InitInput.setNumber(this,7,4,2)"
				/>
		</td>
	</tr>
	<tr>
		<td rowspan="2" align="right"><span class="color_red">*</span>在皖转化并于 ${statYear-1}年实际到账的全部技术成果（项/万元）：</td>
		<td align="right"><span style="color:red">*</span>项目数（项）：</td>
		<td colspan="2">
			<input type="text" style="text-align: right; width: 100px"
				name="proposal/achieve_num" class="required" 
				label="项目基本情况-->项目数"
				value="<x:out select="$xmlData/data/proposal/achieve_num" />"
				onfocus="InitInput.setNumber(this,4,0,0)"
				/>
		</td>
	</tr>
	<tr >
		<td align="right"><span class="color_red">*</span>实际到账金额（万元）：</td>
		<td colspan="2">
			<input type="text" style="text-align: right; width: 100px"
				name="proposal/actural_money" class="required" label="项目基本情况-->实际到账金额" required
				id="actural_money"
				value="<x:out select="$xmlData/data/proposal/actural_money" />" 
				onfocus="InitInput.setNumber(this,7,4,2)"/>
		</td>
	</tr>
	<tr>
		<td align="right"><span class="color_red">*</span>省补助经费用途(限100字)：</td>
		<%-- <td colspan="3">
			<input id="zh_title" name="proposal/help_use_way" label="项目基本情况-->省补助经费用途"
				type="text" required class="input_css required maxlength:100"
				style="width: 725px;height:40px" maxlength="100"
				value="<x:out select="$xmlData/data/proposal/help_use_way" />" />
		</td> --%>
		<td colspan="3">
			<textarea name="proposal/help_use_way" label="项目基本情况-->省补助经费用途" class="input_css required maxlength:100" style="width: 725px;height:80px;" maxlength="100"><x:out select="$xmlData/data/proposal/help_use_way" escapeXml="false"/></textarea>
			<input type="hidden" name="proposal/help_use_way_hidden" value='<x:out select="$xmlData/data/proposal/help_use_way_hidden" escapeXml="false"/>'/>
		</td>
	</tr>
</table>


<table  id="zh_persons" border="0" cellspacing="0" cellpadding="0" class="t_css" >
		<thead>
			<tr>
                <th width="3%">选择</th>
                <th width="3%">序号</th>
				<th width="6%">技术合同名称</th>
				<th width="16%">合同起止日期</th>
				<th width="7%">技术合同网上登记号</th>
				<th width="5%">买方企业名称</th>
				<th width="5%">买方所在市</th>
				<th width="13%">${statYear-1}年实际到账金额（以发票为准，单位：万元）</th>
				<!-- <th width="6%">技术合同交易类别</th>
				<th width="8%">技术合同总金额（万元）</th>
				<th width="8%">实际到账总金额（万元）</th>
				<th width="7%">拉动企业研发投入（万元）</th>
				<th width="7%">预计带动企业新增产值（万元）</th> -->
			</tr>
		</thead>
		<tbody id="tab">
			<tr style="display: none">
				<td  align="center">
					<input type="radio" name="sel_zh_persons"/> 
					<input type="hidden" name="achevies|achevie[0]|award_person_num1" /> 
					<input type="hidden" name="achevies|achevie[0]|award_money" />
					<input type="hidden" name="achevies|achevie[0]|award_person_num2" />
					<input type="hidden" name="achevies|achevie[0]|award_stock" />
					<input type="hidden" name="achevies|achevie[0]|change_result" />
				</td>
				<td align="center">
					<span name="achevies|achevie[0]@seq_no">[index]</span>
				</td>
				<td align="left">
					<span name="achevies|achevie[0]|project_name"></span>
				</td>
				<td align="left">
					<span name="achevies|achevie[0]|project_start_date"></span>~
					<span name="achevies|achevie[0]|project_end_date"></span>
				</td>
				<td align="left">
					<span name="achevies|achevie[0]|project_code"></span>
				</td>
				<td align="left">
					<span name="achevies|achevie[0]|buyer_name"></span>
				</td>
				<td align="left">
					<span name="achevies|achevie[0]|buyer_city"></span>
				</td>
				<td align="center">
					<span name="achevies|achevie[0]|actural2_sum" ></span>
				</td>
				
				<!--以下隐藏  -->
				<td align="left" style="display: none;">
					<span name="achevies|achevie[0]|trade_type"></span>
				</td>
				<td align="center" style="display: none;">
					<span name="achevies|achevie[0]|project_sum" ></span>
				</td>
				<td align="center" style="display: none;">
					<span name="achevies|achevie[0]|actural_sum" ></span>
				</td>
				<td align="center" style="display: none;">
					<span  name="achevies|achevie[0]|comp_inverst" ></span>
				</td>
				<td align="center" style="display: none;">
					<span  name="achevies|achevie[0]|comp_profit" ></span>
				</td>
			</tr>
			<c:set value="0" var="index" scope="page" />
			<x:forEach select="$xmlData/data/achevies/achevie" var="achevie">
				<c:choose>
					<c:when test="${index<10}">
						<c:set value="0" var="flag" scope="page" />
					</c:when>
					<c:otherwise>
						<c:set value="" var="flag" scope="page" />
					</c:otherwise>
				</c:choose>
				<tr>
					<td  align="center">
						<input type="radio" name="sel_zh_persons" /> 
						<input type="hidden" name="achevies/achevie[${flag}${index}]/award_person_num1" value="<x:out select="$achevie/award_person_num1" />"/>
						<input type="hidden" name="achevies/achevie[${flag}${index}]/award_money" value="<x:out select="$achevie/award_money" />"/>
						<input type="hidden" name="achevies/achevie[${flag}${index}]/award_person_num2" value="<x:out select="$achevie/award_person_num2" />"/>
						<input type="hidden" name="achevies/achevie[${flag}${index}]/award_stock" value="<x:out select="$achevie/award_stock" />"/>
						<input type="hidden" name="achevies/achevie[${flag}${index}]/change_result" value="<x:out select="$achevie/change_result" />"/>
					</td>
					<td align="center">
					<span name="achevies/achevie[${flag}${index}]@seq_no">${index+1}</span>
					</td>
					<td align="left">
						<span name="achevies/achevie[${flag}${index}]/project_name"><x:out select="$achevie/project_name" /></span>
					</td>
					<td align="left">
						<span name="achevies/achevie[${flag}${index}]/project_start_date"><x:out select="$achevie/project_start_date" /></span>~
						<span name="achevies/achevie[${flag}${index}]/project_end_date"><x:out select="$achevie/project_end_date" /></span>
					</td>
					<td align="left">					
						<span name="achevies/achevie[${flag}${index}]/project_code"><x:out select="$achevie/project_code" /></span>
					</td>
					<td align="left">
						<span name="achevies/achevie[${flag}${index}]/buyer_name"><x:out select="$achevie/buyer_name" /></span>
					</td>
					<td align="left"> 
						<span name="achevies/achevie[${flag}${index}]/buyer_city"><x:out select="$achevie/buyer_city" /></span>
					</td>
					<td align="center">
						<span name="achevies/achevie[${flag}${index}]/actural2_sum"><x:out select="$achevie/actural2_sum" /></span>
					</td>
					
					<!--以下隐藏  -->
					<td align="left" style="display: none;">
						<span name="achevies/achevie[${flag}${index}]/trade_type"><x:out select="$achevie/trade_type" /></span>
					</td>
					<td align="center" style="display: none;">
						<span name="achevies/achevie[${flag}${index}]/project_sum"><x:out select="$achevie/project_sum" /></span>
					</td>
					<td align="center" style="display: none;">
						<span name="achevies/achevie[${flag}${index}]/actural_sum"><x:out select="$achevie/actural_sum" /></span>
					</td>
					<td align="center" style="display: none;">
						<span name="achevies/achevie[${flag}${index}]/comp_inverst"><x:out select="$achevie/comp_inverst" /></span>
					</td>
					<td align="center" style="display: none;">
						<span name="achevies/achevie[${flag}${index}]/comp_profit"><x:out select="$achevie/comp_profit" /></span>
					</td>
				</tr>
				<c:set value="${index+1}" var="index" scope="page" />
			</x:forEach>
			</tbody>
	</table>
	<table border="0" cellspacing="0" cellpadding="0" class="table01" >
		<col style="width: 77.5%" />
		<col style="width: 22.5%" />
		<tr>
			<td align="right">
				合计（万元）：
			</td>
			<td align="left">
				<input id="actural_daozhang_money" disabled="disabled" style="width:110px;text-align:right" name="proposal/actural_daozhang_money"/>
			</td>	
		</tr>
		<input  type="hidden" name="proposal/year_se" value="${statYear-1}"/>
	</table>
<br>

	<table cellpadding="0" cellspacing="1" style="border:none">
		<tr style="border:none">
			<td style="border:none"
			>
				<input class="button_02" type="button" value="添加" onclick="if(checkTabLimit('zh_persons',299,'最多只能填写299条')){addNewRow('zh_persons','${ctx}/proposal/edit/dialog/achieveInfoAdd_gxyzwzh_2019?parentTab=zh_persons&type=add&needMeetingInfo=${param.needMeetingInfo}&year=${statYear}&TB_iframe=true&height=440&width=900','添加单项成果信息');}try{top.resizeFrame();}catch(e){};">
				&nbsp;<input class="button_02"  id="zh_psnPrev" type="button" value="上移" onclick="movePrev('zh_persons');">
				&nbsp;<input class="button_02"  id="zh_psnNext" type="button" value="下移" onclick="moveNext('zh_persons');">
				&nbsp;<input class="button_02"  id="zh_psnEdit" type="button" value="编辑" onclick="editRow('zh_persons','${ctx}/proposal/edit/dialog/achieveInfoEdit_gxyzwzh_2019?parentTab=zh_persons&type=edit&needMeetingInfo=${param.needMeetingInfo}&year=${statYear}&TB_iframe=true&height=440&width=900','编辑单项成果信息')">
				&nbsp;<input class="button_02"  id="zh_psnDel" type="button" value="删除" onclick="deleteSelectedRow('zh_persons','记录');">
			</td>
		</tr>
	</table>
	
 
<script type="text/javascript">
	$(function() {
		formatNumberAuto(parseFloat($("#actural_money")) + ".0000", 7, 4, 2);
		calDaozhangMoney();
	});

	function deleteSelectedRow(tableId, message, nummin, warnMsg, selName) {
		if (!selName)
			selName = "";
		var tr = $("#" + tableId + " :radio[name*='" + selName + "']:checked").parents("tr");
		if (nummin == null)
			nummin = 0;
		var length = tr.length;
		if (tr.length == 0)
			tr = $("#" + tableId + " tr").filter(":last");
		else if (tr.length > 1)
			tr = tr.first();

		if (tr.get(0).rowIndex - 1 == nummin) {
			scmWarn(irisNotes.delWarn1);
			return false;
		}
		if (length == 0) {

			scmWarn(irisNotes.delWarn2);

			return false;
		}
		if (!confirm(messageTip.deleteTip + message + "？"))
			return false;
		tr.remove();
		calDaozhangMoney();
		refreshRowINdex(tableId);
		return true;
	}
	function setSubmitPsn() {
		if($("#zh_persons :radio:checked").length==0){
			scmWarn('请选择一行!');
			return false;
		}
		var tr = $("#zh_persons :radio:checked").parents("tr");
		if (tr.get(0).rowIndex - 1 == 1) {// 如果选择的是申报人
			$("#zh_psnPrev").attr("disabled", "true").css("color", "#808080");
			$("#zh_psnNext").attr("disabled", "true").css("color", "#808080");
			// $("#zh_psnEdit").attr("disabled","true").css("color","#808080");
			// $("#zh_psnDel").attr("disabled", "true").css("color", "#808080");

		} else {
			$("#zh_psnPrev").removeAttr("disabled").css("color", "#003366");
			$("#zh_psnNext").removeAttr("disabled").css("color", "#003366");
			// $("#zh_psnEdit").removeAttr("disabled").css("color","#003366");
			$("#zh_psnDel").removeAttr("disabled").css("color", "#003366");
		}

	}
	function calDaozhangMoney() {
		var good_sum = 0.00;
		$("#zh_persons span[name$=actural2_sum]:gt(0)").each(function() {
			good_sum += parseFloat($(this).text());
		})
		$("#actural_daozhang_money").val(formatNumberAuto(parseFloat(good_sum) + ".0000", 7, 4, 2));
	}

	function initTreeValueExt(treeId, treeNode) {
		if ((treeNode && treeNode.isParent)) {
			scmWarn("请选择具体的" + $("#" + treeId).attr("label"));
			$("#" + treeId).val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val("");
			return false;
		}
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			str = obj.name + "-" + str;
			obj = obj.parentNode;
		}

		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId + "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId + "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId + "_name']").val(str);
	}
</script>
